#include <iostream>
#include <sstream>

using namespace std;

string s1, s2;

int main()
{
//	cin >> s1 >> s2;
	getline(cin, s1);
	getline(cin, s2);
	
	int n = s1.size(), m = s2.size();
	
//	cout << n << endl;
	
	
	int cnt = 0;
	
	for (int i = 0; i < n; i ++ )
	{
		if (isupper(s1[i])) s1[i] += 32;
	}
	
	for (int i = 0; i < m; i ++ )
	{
		if (isupper(s2[i])) s2[i] += 32;
	}
	stringstream ssin(s2);
	
	string a;
//	cout << s1 << "===" << s2 << endl;
	while (ssin >> a)
	{
		if (a == s1) 
		{
//			if (!flag)
//			{
//				res = t;
////				flag = true;	
//			}
			cnt ++ ;
		}
		
//		t += a.size() + 1;
	}
	s1 = ' ' + s1 + ' ';
	s2 = ' ' + s2 + ' ';
	
	
	
	
	bool flag = false;
	
	int res = -1;
	
	
	int t = 0;
	while (s2[t] == ' ') t ++ ;
	
	
	
	
//	for (auto a : s2)
	
	
//	if (!flag) puts("-1");
		int aa = s2.find(s1);
	if (aa == -1) puts("-1");
	else cout << cnt << ' ' << aa << endl;
	
	return 0;
	
}
//u
//tIXHUguyz PZYAJL  BIv NAPoemaJ aTF LOvhV m s LSa n xDn mQnO T ettIq T  AL  fG B Xme  t  fct U  tQ  d
//
//td
//  Td tLWCsrmt
//